package br.com.sig.presentation.converter;

import javax.enterprise.context.RequestScoped;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;

/**
 * Converter CEP
 *
 */
@FacesConverter(value = "percentConverter")
@RequestScoped
public class PercentConverter implements Converter {

	public Object getAsObject(FacesContext context, UIComponent ui, String value) {
		return value;
	}

	public String getAsString(FacesContext context, UIComponent ui, Object obj) {
		if (obj == null) {
			return null;
		}

		Integer value = (Integer) obj;		

		return value.toString() +"%";
	}

}